﻿<!--#include file="../Include/Config.asp"-->
<%
dim action,Admin_id,Admin_name,Admin_pass
dim Admin_email,sql,Admin_user,Admin_info
action=request.QueryString("action")
Admin_id=request.QueryString("Admin_id")
Admin_user=trim(request.Form("Admin_user"))
Admin_name=trim(request.Form("Admin_name"))
Admin_pass=md5(md5(trim(request.Form("Admin_pass")),32),16)
Admin_email=trim(request.Form("Admin_email"))
Admin_info=trim(request.Form("Admin_info"))

select case action
   case "add"  call add
   case "edit" call edit
end select
%>
<%sub add	
sql="select * from Admins where Admin_user='"&Admin_user&"'"
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("Admin_user")=Admin_user
rs("Admin_name")=Admin_name
rs("Admin_pass")=Admin_pass
rs("Admin_email")=Admin_email
rs("Admin_info")=Admin_info
rs("Admin_logintime")=date
rs("Admin_addtime")=now()
rs("Admin_logintimes")=0
rs("Admin_info")=Admin_info
rs.update%>
<%=ShowAlert("管理员添加成功","AdminList.asp")%>
<%else%>
<%=ShowAlert("该管理员已存在","")%>
<%end if
rs.close
end sub%>


<%sub edit%>
<%
call CheckNum(Admin_id)
sql="select * from Admins where Admin_id ="&Admin_id&""
rs.open sql,conn,1,3
rs("Admin_user")=Admin_user
rs("Admin_name")=Admin_name
rs("Admin_email")=Admin_email
rs("Admin_info")=Admin_info
rs("Admin_logintime")=date
rs.update%>
<%=ShowAlert("管理员修改成功","AdminEdit.asp?Admin_id="&Admin_id&"")%>
<%rs.close
end sub%>
